{include file="public/head"}
<div class="main">
    {include file="public/left"}
    <div class="middle">
    {include file="public/header"}
    <div class='userinfo'>
        {include file="public/userleft"}
        <div class="user_middle">
            <ul>
                <dl>
                    <dd class='middle_title'>
                        <img id="avatar" src="{$osslink}static/index/image/index/avgdefaultsmall.jpg?lang=zh-cn&{$version}" width="47px" height="47px"  />
                        <div>
                            <p>{:__('你好')}，<span id="username"></span>
                                <!-- <i data-title="{:__('vip认证')}" id="vipverity" class="fa fa-user-times" aria-hidden="true"></i> -->
                                <i data-title="{:__('邮箱认证')}" class='layui-icon emailverity'>&#xe618;</i>
                            </p>
                        </div>
                    </dd>
                    <dd>
                        <h6>{:__('我的账户')}：</h6>{:__('金币')}<span></span><span id="money">0.00</span>$，{:__('冻结金币')}<span id="freeze">0.00</span>$。<a href="/index/User/online">{:__('立即充值')}</a>
                    </dd>
                </dl>

                <dl>
                    <dd class='middle_title'>{:__('基本信息')}</dd>

                    <dt>
                        <p>{:__('用户等级')}：<span id="credit_level_txt"></span>{:__('信用分')}：<span id="integral"></span></p>
                        <!-- <p>{:__('好评率')}：<span>0</span>
                            <div class="comment_star">
                                <i class="heart fa fa-star" aria-hidden="true"></i>{:__('好评数')}：<span>0</span>
                                <i class="heart fa fa-star-half-o" aria-hidden="true"></i>{:__('中评数')}：<span>0</span>
                                <i class="heart fa fa-star-o" aria-hidden="true"></i>{:__('差评数')}：<span>0</span>
                            </div>
                        </p>
                        <p>{:__('雇主好评率')}：<span>0</span>
                            <div class="comment_star">
                                <i class="heart fa fa-star" aria-hidden="true"></i>{:__('好评数')}：<span></span>
                                <i class="heart fa fa-star-half-o" aria-hidden="true"></i>{:__('中评数')}：<span>0</span>
                                <i class="heart fa fa-star-o" aria-hidden="true"></i>{:__('差评数')}：<span>0</span>
                            </div>
                        </p> -->
                        <hr/>
                    </dt>
                    <dt>
                        <h6>{:__('认证信息')}</h6>
                        <p>{:__('邮箱认证')}：<i data-title="{:__('邮箱认证')}" class='layui-icon emailverity'>&#xe618;</i></p>
                        <hr/>
                        <!-- <p>{:__('您现在的等级是普通会员')}, <a href='/index/User/vipadd'>{:__('立即充值vip')}</a>.</p> -->
                    </dt>
                
                </dl>
                
            </ul>
        </div>
        <div class="user_right">
            <div class='user_total'>
                <h3>{:__('统计信息')}</h3>
                <ul>
                    <dl>{:__('注册时间')}：<span class='regist_time'></span></dl>
                    <dl>{:__('发布任务')}：<span id='mission_created'>0</span>{:__('条')}</dl>
                    <dl>{:__('参与任务')}：<span id='mission_involved'>0</span>{:__('条')}</dl>
                    <dl>{:__('中标次数')}：<span id='mission_involved_win'>0</span>{:__('条')}</dl>
                </ul>
            </div>
            <div class='user_notice'>
                <h3>{:__('网站公告')}</h3>
                <ul>
                    
                </ul>
            </div>
            <div class='user_help'>
                <h3>{:__('帮助中心')}</h3>
                <ul>
                    
                </ul>
            </div>
        </div>
    </div>
    {include file="public/foot"}
    </div>
    {include file="public/right"}
</div>
{include file="public/footer"}
<script>
    noLog();

    $(document).queue('user',function(){
        var userData = getLocalStorage('userData');
        var userdata = JSON.parse(userData);
        $("#username").html(userdata['username']);
        if(userdata['profile'] == '' || userdata['profile'] == null || userdata['profile'] == undefined){
            userdata['profile'] = {};
        }
        if(userdata['profile'] == '' || userdata['profile'] == null || userdata['profile'] == undefined ||
        userdata['profile']['avatar'] == '' || userdata['profile']['avatar'] == null || userdata['profile']['avatar'] == undefined){
            userdata['profile']['avatar'] = '{$osslink}static/index/image/index/avgdefaultsmall.jpg?lang=zh-cn&{$version}';
        }
        $("#avatar").attr("src",userdata['profile']['avatar']);
        if(userdata['money'] != '' && userdata['money'] != null && userdata['money'] != undefined){
            $("#money").html(userdata['money']);
        }
        if(userdata['freeze'] != '' && userdata['freeze'] != null && userdata['freeze'] != undefined){
            $("#freeze").html(userdata['freeze']);
        }

        if(userdata['credit'] != '' && userdata['credit'] != null && userdata['credit'] != undefined){
            credit = userdata['credit'];
        } else {
            var credit = {'integral':0,'level':0,'credit_level_txt':'{:__("新晋")}'}
        }
        if(credit['credit_level_txt'] != '' && credit['credit_level_txt'] != null && credit['credit_level_txt'] != undefined){
            var level_txt = credit['credit_level_txt'];
        } else {
            var level_txt = '{:__("新晋")}';
        }
        
        if(credit['level'] != '' && credit['level'] != null && credit['level'] != undefined){
            level_txt += levelObj[credit['level']];
        } else {
            level_txt += levelObj[1];
        }
        if(credit['integral'] != '' && credit['integral'] != null && credit['integral'] != undefined){
            var integral = credit['integral'];
        } else {
            var integral = 0;
        }
        
        $("#credit_level_txt").html(level_txt);
        $("#integral").html("<a href='/index/User/reputation' style='text-decoration:none;font-size: 13px;'>"+integral+"</a>");
        $(".regist_time").html(userdata['create_time']);

        if(userdata['stats'] != '' && userdata['stats'] != null && userdata['stats'] != undefined){
            if(userdata['stats']['mission_created'] != '' && userdata['stats']['mission_created'] != null && userdata['stats']['mission_created'] != undefined){
                $("#mission_created").html(userdata['stats']['mission_created']);
            }
            if(userdata['stats']['mission_involved'] != '' && userdata['stats']['mission_involved'] != null && userdata['stats']['mission_involved'] != undefined){
                $("#mission_involved").html(userdata['stats']['mission_involved']);
            }
            if(userdata['stats']['mission_involved_win'] != '' && userdata['stats']['mission_involved_win'] != null && userdata['stats']['mission_involved_win'] != undefined){
                $("#mission_involved_win").html(userdata['stats']['mission_involved_win']);
            }
        }
        
        if(userdata['emailauth'] == 1){
            $(".emailverity").each(function(){
                var parent = $(this).parent();
                $(this).remove();
                var htl = parent.append("<i data-title='{:__('邮箱认证')}' class='layui-icon emailverity' style='color:rgb(122,194,253) !important'>&#xe618;</i>");
            });
        }
        $(".user_middle ul dl dd div p i").on("mouseover",function(){
            var title = $(this).attr("data-title");
            layer.tips('<span style="color:black">'+title+'</span>',         
            this, 
            {tips:[2, '#ffffff'], time:1000});
        });
    });
    // $(document).dequeue('outcache');
    $.ajax({
        url:'/api/info/listbycat',
        type:'get',
        data:{limit:5,cat_id:'75,30'},
        success:function(ret){
            if(ret['code'] == 1){
                if(ret['data'] == '' || ret['data'] == null || ret['data'] == undefined){
                    return false;
                }
                var noticehtl = "";
                for(i in ret['data'][30]['_list']){
                    noticehtl += "<li><i class='fa fa-location-arrow' aria-hidden='true'></i><a href='/"+ret['data'][30]['_list'][i]['route']+"'>"+ret['data'][30]['_list'][i]['title']+"</a></li>";
                }
                $(".user_notice ul").html(noticehtl);
                var helphtl = "";
                for(j in ret['data'][75]['_list']){
                    helphtl += "<li><i class='fa fa-location-arrow' aria-hidden='true'></i><a href='/"+ret['data'][75]['_list'][j]['route']+"'>"+ret['data'][75]['_list'][j]['title']+"</a></li>";
                }
                $(".user_help ul").html(helphtl);
            } else if(ret['code'] != 401){
                layer.msg(ret.msg,{icon:2});
            }
        }
    });
</script>